package org.ece3574.WTParty;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class EventsList extends Activity{
	 ListView lv;

    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.eventslist);
    	 //setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES));
   	 	String[] Parties = getResources().getStringArray(R.array.parties_array);

    	   
    	  // setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, Parties));

    	  lv = (ListView) findViewById(R.id.list); //getListView();
    	  lv.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_single_choice, Parties));
  		  lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    	  //lv.setTextFilterEnabled(true);

    	  lv.setOnItemClickListener(new OnItemClickListener() {
    		  public void onItemClick(AdapterView<?> parent, View view, int  posistion, long id){
    			  
  				//transfer to information activity
  				Intent i = new Intent(view.getContext(), PartyTabActivity.class);
				startActivity(i);				          
    			  
    		      // When clicked, show a toast with the TextView text
    		    //  Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
    		         // Toast.LENGTH_SHORT).show();
    		    }
		});
    	
    	//setContentView(R.layout.list_item);
        /*TextView view =	(TextView) findViewById(R.id.TextView02);
        String s="";
        for (int i=0; i < 100; i++) {
        	s += "test n/";
        }
        view.setText(s);*/
    }
    
    /*static final String[] COUNTRIES = new String[] {
        "Afghanistan", "John's party", "Jey's surprise party", "Wayne customs party"};*/
    

    
    
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu2, menu);
        return true;
    }
    
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    	Intent intent2;
        switch (item.getItemId()) {
        
        case R.id.Add:	intent2 = new Intent().setClass(this, AddEvent.class);
        				startActivity(intent2);
        				break;


        }
        return true;
    }

}
